app.controller('todayPurchaseOrderController', ['$scope', 'ajax', 'Flash','$state','$filter',function ($scope, ajax,Flash,$state,$filter) {

    $scope.queryData={
        ctime_like:''
    }

    $scope.data={
        purchaseOrderId:''
    }


    ajax.get({
            url: 'back/purchaseOrder/pageStatistics',
            debug: true
        }).then(function (result) {
            if(result){
                return
            }
            $scope.totalSize=result.statistics;
            $scope.data=result.statistics;
            $scope.data.purchaseOrderId=result.statistics.purchaseOrderId;
        })


    //查询
    $scope.doQuery = function (orderNo,ctime_like) {

        var ctime_like=$filter('date')($scope.queryData.ctime_like,'yyyy-MM-dd');
        $scope.queryData.ctime_like=ctime_like;

        ajax.get({
            url: "back/purchaseOrder/pageStatistics",
            data: {

                ctime_like:$scope.queryData.ctime_like
            }
        }).then(function (result) {
            $scope.totalSize=result.statistics.totalPageSize;
            $scope.data=result.statistics;
            $scope.data.purchaseOrderId=result.statistics.purchaseOrderId;
        });
    };


    //重置按钮
    $scope.reset=function(){
        $scope.queryData={};
    }
        // 预订单列表列表

        $scope.genernate = function () {
            ajax.get({
                url: '/back/purchaseOrder/genernate',
                debug: true
            }).then(function (result) {

                Flash.create('success', '生成成功', 'custom-class');
                $state.go('admin.linePreOrder',null,{
                    reload:true
                });
            })

         }


    }]);